<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>then 方法</title>
  </head>
  <body>
    <script>
      let p = new Promise((resolve, reject) => {
        // resolve("OK");
        // reject('Error');
        // pending 状态下, then 方法中的回调都是不执行的
      });

      //调用 then 方法处理成功或失败的结果值
      p.then(value => {
        console.log(value);
      }, reason=>{
        console.warn(reason);
      })
    </script>
  </body>
</html>
